package com.cykj.handler;
import com.cykj.entity.UserEntity;

import com.cykj.service.loginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
public class LoginHandler {
    @Autowired
    private loginService loginService;

    @RequestMapping("/loginCon")
    public Map<String,Object> login(@RequestParam("acc1") String acc, @RequestParam("psw1") String psw){
        System.out.println(acc+","+psw);
        Map<String,Object> map = new HashMap<>();
        List<UserEntity> list = loginService.selUser(acc,psw);
        if (list.size()>0){
            map.put("succ",1);
            map.put("data",list);
        }else {
            map.put("sb",2);
        }
        return map;
    }

}
